home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_300 / 352_01 / strppcmp.cpp < prev    next >
C/C++ Source or Header  |  1991-04-28  |  715b  |  27 lines

  1. //    STRPPCMP.CPP - contains String::cmp()
  2. //        This routine in the String class compares two strings.
  3. //        Case sensitive or not, as set by String::caseSens.
  4. //
  5. #include <stdlib.h>
  6. #include <string.h>
  7. #include <alloc.h>
  8. #include <iostream.h>
  9. #include <ctype.h>
  10.  
  11. #include "dblib.h"
  12.  
  13. // NOTE: routine declared static in class {}. No 'this' ptr.        
  14. int String::cmp (char *a, char *b)
  15.         // String::cmp is a utility function for class String.
  16.         // routine compares two strings 
  17.         // checks for caseSens compares
  18.         {
  19.         if ( a==NULL )
  20.             return ( b==NULL ) ? 0 : -1;
  21.         else 
  22.         if ( b== NULL ) 
  23.             return +1;
  24.         else
  25.         return String::caseSens ? strcmp (a,b) : stricmp (a,b);
  26.         }        // end String::cmp()
  27.